const { DataTypes } = require('sequelize');

// 存储logs。
module.exports = sequelize => sequelize.define(
  'Log',
  {
    method: DataTypes.STRING,
    url: DataTypes.STRING,
    http_version: DataTypes.STRING,
    status: {
      type: DataTypes.BIGINT,
      defaultValue: 200,
    },
    message: DataTypes.STRING,
    remote_addr: DataTypes.STRING,
    visit_time: DataTypes.DATE,
    user: DataTypes.STRING,
    user_agent: DataTypes.STRING,
    content_length: DataTypes.BIGINT,
    referrer: DataTypes.STRING,
  },
  {
    timestamps: true,
    paranoid: true,
  },
);
